package com.sctvcloud.longchang.ui.adapter.holder;

import android.content.Context;
import android.view.View;
import android.widget.RelativeLayout;

import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.sctvcloud.longchang.R;
import com.sctvcloud.longchang.beans.TelInfo;
import com.sctvcloud.longchang.beans.TelTitle;

import butterknife.BindView;
import butterknife.ButterKnife;

public class TelephoneHolder extends BaseAbsHolder<TelInfo> implements View.OnClickListener {
    @BindView(R.id.select_layout)
    protected RelativeLayout select_layout;
    @BindView(R.id.name)
    protected CustomFontTextView name;
    @BindView(R.id.phone_number)
    protected CustomFontTextView phone_number;
    private TelInfo info;
    private OnTelephoneClickListener listener;

    public TelephoneHolder(Context context, View itemView, OnTelephoneClickListener listener) {
        super(context, itemView);
        this.listener = listener;
    }

    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(TelInfo info) {
        select_layout.setOnClickListener(this);
        this.info = info;
        name.setText(info.getName());
        phone_number.setText(info.getPhoneNo());
    }

    @Override
    public void onClick(View v) {
        if (null != listener) {
            listener.OnTelephoneClick(info);
        }
    }

    public interface OnTelephoneClickListener {
        void OnTelephoneClick(TelInfo info);
    }
}
